package guiHandler;
/**
 * 
 * @author Peter Steiner & Fredrik Wallenius
 *
 */
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import adapterHandler.GuiSockAdapter;

public class myFrame {

	ChatWindow chatWindow;
	JMenuBar menuBar;
	JFrame frame;
	EastPanel east;
	public myFrame(GuiSockAdapter adapter){
		
		chatWindow = new ChatWindow(adapter);
		
		frame = new JFrame("Chat Window");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Add contents to the window.
        east = new EastPanel();
        adapter.setEast(east);
        frame.add(chatWindow);
        frame.add(east, BorderLayout.EAST);
        
        menuBar();
		
        
        //Display the window.
        frame.pack();
        frame.setVisible(true);
        
	}	 
	
	public void menuBar(){
		menuBar = new JMenuBar();
		menuBar.setBounds(490, 0, 50, 640);
		frame.setJMenuBar(menuBar);
 
		
		
		JMenu fileMenu = new JMenu("File");
    	menuBar.add(fileMenu);

	    	JMenuItem Pause = new JMenuItem("Pause");
	    	fileMenu.add(Pause);

    	
	    	JMenuItem quitItem = new JMenuItem("Exit");
	    	fileMenu.add(quitItem);
			

		    	quitItem.addActionListener(new ActionListener() {
		    		public void actionPerformed(ActionEvent ae) {
		    				System.exit(0);
		    		}
		    	});
		    	
		    	Pause.addActionListener(new ActionListener() {
		    		public void actionPerformed(ActionEvent ae) {
		    		
		    		}
		    	});
		    	
		    
		// Menu choice About    	
    	JMenu About = new JMenu("About");
    	menuBar.add(About);
	    	
    		//info in About
	    	JLabel teamInfo1 = new JLabel("Chat client written by:");
	    	About.add(teamInfo1);
	    	JLabel teamInfo2 = new JLabel("Fredrik Wallenius and Peter Steiner");
	    	About.add(teamInfo2);
		
	}
		
	
	
	public ChatWindow getChatWindow(){
		return chatWindow;
	}
}
